/*-----------------------------------------------------------------------------
 * @file   hal.h
 * @brief  head file for hardware abstraction layer
 * @author WLH<wanglehui8357@163.com> Copyright (C) 2021~2099.
-----------------------------------------------------------------------------*/
#ifndef HAL_H
#define HAL_H

#include "globaldef.h"

BEGIN_DECLS

/*-----------------------------------------------------------------------------
 * include header file by configure
-----------------------------------------------------------------------------*/
#include "hal_adc.h"
#include "hal_can.h"
#include "hal_delay.h"
#include "hal_gpio.h"
#include "hal_hrt.h"
#include "hal_i2c.h"
#include "hal_irq.h"
#include "hal_led.h"
#include "hal_uart.h"

/*------------------------------------------------------------------------------
 * Macro define
------------------------------------------------------------------------------*/
#define HAL_RST_REASON_PWR_ON  0x00u /* Power On Reset  */
#define HAL_RST_REASON_SOFT    0x01u /* Software Reset  */
#define HAL_RST_REASON_WDT     0x02u /* WatchDog Reset  */
#define HAL_RST_REASON_USER    0x03u /* Button Reset    */
#define HAL_RST_REASON_PWR_LOW 0x04u /* Low power Reset */
#define HAL_RST_REASON_DEBUG   0x05u /* Debugger Reset  */

/*------------------------------------------------------------------------------
 * public functions declaration
------------------------------------------------------------------------------*/
/**
 * @brief Initialize All HAL Modules (must be called before RTOS start)
 */
void hal_init(void);
/**
 * @brief Initialize a system reset request to reset the MCU.
 */
void hal_reboot(void);
/**
 *@brief reconfigure the system clock
*/
void system_clock_reconfig(void);

// ZD24C512A
bool hal_eeprom_init(const U8 port_num);
U16  hal_eeprom_read(const U16 addr, U8* data, const U16 sz);
U16  hal_eeprom_write(const U16 addr, U8* data, const U16 sz);

END_DECLS

#endif //~HAL_H
